package cn.wen.rpc.balance;import lombok.extern.slf4j.Slf4j;import java.net.InetSocketAddress;import java.util.ArrayList;import java.util.List;import java.util.Set;@Slf4jpublic class RoundRobinLoadBalance implements LoadBalance{    @Override    public String name() {        return "roundRobin";    }    Integer pos = 0;    @Override    public InetSocketAddress loadBalance(Set<String> services) {        // 每次需要走下一个        List<String> list = new ArrayList<>();        synchronized (pos) {            if (pos >= services.size()) {                pos = 0;            }            String ipAndPort = list.get(pos);            log.info("使用了轮询负载均衡器，地址:{}", ipAndPort);            new InetSocketAddress(ipAndPort.split(",")[0], Integer.parseInt(ipAndPort.split(",")[1]));        }        return null;    }}